package com.example.petproject.service.impl;

import com.example.petproject.entity.model.PmsComment;
import com.example.petproject.entity.model.PmsCommentPic;
import com.example.petproject.mapper.PmsCommentMapper;
import com.example.petproject.mapper.PmsCommentPicMapper;
import com.example.petproject.service.CommentPicService;
import com.example.petproject.service.PmsCommentService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * 包名称：com.example.petproject.service.impl
 * 类名称：CommentPicServiceImpl
 * 类描述：
 * 创建人：@author DrinkMore-HotWater
 * 创建时间：2024年01月20日 14:34
 **/
@Service
public class CommentPicServiceImpl implements CommentPicService {

    @Resource
    private PmsCommentPicMapper pmsCommentPicMapper;
    @Resource
    private PmsCommentService pmsCommentService;

    @Override
    public Long addCommentPic(String filePath) {
        //先组装一个commentPic对象
        PmsCommentPic pmsCommentPic = new PmsCommentPic();
        pmsCommentPic.setPicUrl(filePath);
        pmsCommentPic.setCreatedTime(LocalDateTime.now());
        pmsCommentPic.setUpdatedTime(LocalDateTime.now());
        int result = pmsCommentPicMapper.insertSelective(pmsCommentPic);
        return result>0?pmsCommentPic.getId():null;
    }
}
